// stores/permission.js
import { defineStore } from 'pinia'
import { asyncRoutes } from '@/router'

export const usePermissionStore = defineStore('permission', {
  state: () => ({
    routes: []
  }),

  actions: {
    generateRoutes(roles) {
      let routes = []
      if (roles.includes('admin')) {
        routes = asyncRoutes
      } else {
        routes = filterAsyncRoutes(asyncRoutes, roles)
      }
      this.routes = routes
      return routes
    }
  }
})

function filterAsyncRoutes(routes, roles) {
  // 自定义过滤逻辑
}
